import axios from "axios";
// const baseUrl = 'https://rrbstest.hopernet.com:9565/api/mall' // dev api
//const baseUrl = 'https://rrbstest.hopernet.com:20010/api/mall' // dev api 人人播
// const baseUrl = "https://zhuoyu.hopernet.com:9566/api/mall"; // 卓羽优选
// const baseUrl = "https://mall.hopernet.com:18888/api/mall"; //翻牌、厚普
// const baseUrl = "https://xccakemall.hopernet.com:8191/api/mall"; //小宠

// const baseUrl = '/api/mall' //build api
// const baseUrl = 'http://192.168.1.121:9565/mall' //王旭
// const baseUrl = 'http://192.168.1.64:9565/mall' //王旭
// const baseUrl = 'http://192.168.43.95:9565/mall' //何桐
const baseUrl = 'http://192.168.1.176:9565/mall'
// const baseUrl = 'http://192.168.1.177:9562/mall' //佳伦
// const baseUrl = 'http://192.168.1.180:9565/mall' //张淦铭
// const baseUrl = 'http://192.168.1.162:9565/mall' //张淦铭
// const baseUrl = 'http://192.168.43.239:9565/mall' //张淦铭2

const Axios = axios.create({ baseURL: baseUrl });
Axios.interceptors.request.use(
	config => {
		// if (localStorage.token) {
		//     config.headers.Authorization = 'Bearer ' + localStorage.token
		// }
		return config;
	},
	error => {
		return Promise.reject(error);
	}
);

Axios.interceptors.response.use(
	response => {
		let data = response.data;
		return data;
	},
	error => {
		let response = error.response;
		return Promise.reject(response.data ? response.data : response);
	}
);

export default Axios;
